package ch.usi.inf.pf2.gui.chart;

import java.awt.Color;

/**
 * 
 * @author Lorenzo Baracchi <lorenzo.baracchi@usi.ch>
 *
 */
public enum ChartColor
{
    C1 (Color.RED),
    C2 (Color.BLUE),
    C3 (Color.GREEN),
    C4 (Color.YELLOW),
    C5 (Color.ORANGE),
    C6 (Color.CYAN),
    C7 (Color.MAGENTA),
    C8 (Color.ORANGE);
    
    private Color color;
    private final static int number=9;

    private ChartColor(Color color)
    {
	   this.color=color;
    }

    public Color getColor()
    {
	   return color;
    }
    
    public static Color selectColor(int n)
    {
	   n= n%number;
	   switch(n)
	   {
	   	case 1:
	   	    return C1.getColor();
	   	case 2:
	   	    return C2.getColor();
	   	case 3:
	   	    return C3.getColor();
	   	case 4:
	   	    return C4.getColor();
	   	case 5:
	   	    return C5.getColor();
	   	case 6:
	   	    return C6.getColor();
	   	case 7:
	   	    return C7.getColor();
	   	case 8:
	   	    return C8.getColor();
	   	default:
	   	    return C1.getColor();
	   }
    }
}
